package com.zhz.mall.portal.controller;

import com.zhz.mall.common.api.CommonResult;
import com.zhz.mall.portal.dto.ProductDetailDTO;
import com.zhz.mall.portal.modules.pms.service.PmsProductService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * @author zhouhengzhe
 */
@RestController
@Api("商品详情服务接口")
@RequestMapping("/product")
public class ProductController {

    @Autowired
    PmsProductService productService;

    /**
     * 获取商品详情
     * .get(`/product/detail/${this.id}`)
     */
    @RequestMapping("/detail/{id}")
    public CommonResult<ProductDetailDTO> getProductDetail(@PathVariable Long id) {
        return CommonResult.success(productService.getProductDetail(id));
    }
}
